import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

class Person implements Comparable<Person>{
	private String name;
	private int age;
	private boolean gender;
	public Person(String name, int age, boolean gender) {
		this.name = name;
		this.age = age;
		this.gender = gender;
	}
	@Override
	public String toString() {
		return name + "-" + age + "-" + gender;
	}
	public boolean equals(Person obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Person other = (Person) obj;
		if (age != other.age)
			return false;
		if (gender != other.gender)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
	@Override
	public int compareTo(Person o) {
		// TODO Auto-generated method stub
		if (this.name.compareTo(o.name)<0) return -1;
		if (this.name.compareTo(o.name)>0) return 1;
		if (this.name.compareTo(o.name)==0){
			if (this.age == o.age) return 0;
			if (this.age > o.age) return 1;
			if (this.age < o.age) return -1;
		}
		return 0;
	}
	
}
class Student extends Person{
	private String stuNo;
	private String clazz;
	public Student(String name, int age, boolean gender,String stuNo, String clazz) {
		super(name, age, gender);
		this.stuNo=stuNo;
		this.clazz=clazz;
	}
	public String toString() {
		return "Student:" +super.toString() + "-" + stuNo + "-" + clazz;
	}
	public boolean equals(java.lang.Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Student other = (Student) obj;
		if (super.equals(other)) {
			if (clazz == null) {
				if (other.clazz != null)
					return false;
			} else if (!clazz.equals(other.clazz))
				return false;
			if (stuNo == null) {
				if (other.stuNo != null)
					return false;
			} else if (!stuNo.equals(other.stuNo))
				return false;
		}
		
		return true;
	}
	
}
class Company{
	private String name;
	public Company(String name) {
		this.name = name;
	}
	public String toString(){
		return this.name;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Company other = (Company) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
}
class Employee extends Person{
	Company company;
	private double salary;
	public Employee(String name, int age, boolean gender, double salary, Company company) {
		super(name, age, gender);
		this.salary=salary;
		this.company=company;
	}
	public String toString() {
		return "Employee:"+super.toString()+"-"+company +"-"+salary;
	}
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Employee other = (Employee) obj;
		if (super.equals(other)) {
			if (company == null) {
				if (other.company != null)
					return false;
			} else if (!company.equals(other.company))
				return false;
			DecimalFormat df = new DecimalFormat("#.#");
			if (df.format(salary) != df.format(other.salary))
				return false;
		}
		return true;
	}
}

public class Main06 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner (System.in);
		String perstr;
		List<Person> personList=new ArrayList<Person>();
		List<Student> stuList=new ArrayList<Student>();
		List<Employee> empList=new ArrayList<Employee>();
		personList.removeAll(personList);
		stuList.removeAll(stuList);
		empList.removeAll(empList);
		int temp = 0,flag = 0;
		while(sc.hasNext()){
			String str=sc.next();
			if (str.equals("s")) {
				personList.add(new Student(sc.next(),sc.nextInt(),sc.nextBoolean(),sc.next(),sc.next()));
			}else if (str.equals("e")) {
				personList.add(new Employee(sc.next(),sc.nextInt(),sc.nextBoolean(),sc.nextDouble(),new Company(sc.next())));
			}
			else break;
		}
		Collections.sort(personList);
		for (Person u : personList) {
			System.out.println(u);
		}
		String str1=sc.next();
		if (str1.equals("exit")){
			sc.close();
			return;
		}
		for (int i = 0; i < personList.size(); i++) {
			Person person=personList.get(i);
			if (person instanceof Student) {
				Student student= (Student) person;
				if( i == 0 ){
					stuList.add(student);
					continue;
				}
				for (int j = 0; j < stuList.size(); j++) {
					if(stuList.get(j) != null)
					if(student.equals(stuList.get(j))) temp = 1;
				}
				if (temp == 0){
					stuList.add(student);
				}
				temp = 0;
			}else if (person instanceof Employee) {
				Employee employee=(Employee) person;
				if( i == 0 ){
					empList.add(employee);
					continue;
				}
				for (int j = 0; j < empList.size(); j++) {
					if(empList.get(j) != null)
					if(employee.equals(empList.get(j))) flag = 1;
				}
				if (flag == 0){
					empList.add(employee);
				}
				flag = 0;
			}
		}
		System.out.println("stuList");
		Collections.sort(stuList);
		for (Student s : stuList) {
			System.out.println(s);
		}
		System.out.println("empList");
		Collections.sort(empList);
		for (Employee e : empList) {
			System.out.println(e);
		}
		sc.close();
	}
}